/*! \file UnicodeConverter.h
 *	\brief <write description for UnicodeConverter.h>
 *
 *	created:	2010/08/08
 *	created:	8:8:2010   19:04
 *	filename: 	C:\Users\venn\Documents\projects\tactics-engine\libs\utils\UnicodeConverter.h
 *	file path:	C:\Users\venn\Documents\projects\tactics-engine\libs\utils
 *	file base:	UnicodeConverter
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#ifndef _utils_UNICODECONVERTER_H_
#define _utils_UNICODECONVERTER_H_

#pragma once

#include <string.h>

#include "core/exception.h"
#include "core/types.h"
#include "core/String.h"
#include "core/vector.h"

namespace tt{
namespace utils{

//////////////////////////////////////////////////////////////////////////
// ANSI - CP_ACP

//! Conversion from ANSI to UTF-16 (static buffer MaxLen)
template<Int MaxLen>
StringW from_ansi(const Char* ansi_string);

//! Conversion from ANSI to UTF-16 (static buffer 1024 bytes)
StringW from_ansi_1024(const Char* ansi_string);

//! Conversion from ANSI to UTF-16 (dynamic buffer)
StringW from_ansi_ex(const Char* ansi_string);

//Static conversion buffer
//! Conversion from ANSI to UTF-16 (static buffer MaxLen)
template<Int MaxLen>
StringW from_ansi(const String& ansi_string);

//! Conversion from ANSI to UTF-16 (static buffer 1024)
StringW from_ansi_1024(const String& ansi_string);

//! Conversion from ANSI to UTF-16 (dynamic buffer)
StringW from_ansi_ex(const String& ansi_string);

//////////////////////////////////////////////////////////////////////////

//! Conversion from UTF-16 to ANSI (static buffer MaxLen)
template<Int MaxLen>
String to_ansi(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (static buffer 1024)
String to_ansi_1024(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (dynamic buffer)
String to_ansi_ex(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (static buffer MaxLen)
template<Int MaxLen>
String to_ansi(const StringW& wide_string);

//! Conversion from UTF-16 to ANSI (static buffer 1024)
String to_ansi_1024(const StringW& wide_string);

//! Conversion from UTF-16 to ANSI (dynamic buffer)
String to_ansi_ex(const StringW& wide_string);

//////////////////////////////////////////////////////////////////////////
// UTF-8

//! Conversion from UTF-8 to UTF-16 (static buffer MaxLen)
template<Int MaxLen>
StringW from_utf8(const Char* ansi_string);

//! Conversion from ANSI to UTF-8 (static buffer 1024 bytes)
StringW from_utf8_1024(const Char* ansi_string);

//! Conversion from ANSI to UTF-8 (dynamic buffer)
StringW from_utf8_ex(const Char* ansi_string);

//Static conversion buffer
//! Conversion from ANSI to UTF-8 (static buffer MaxLen)
template<Int MaxLen>
StringW from_utf8(const String& ansi_string);

//! Conversion from ANSI to UTF-8 (static buffer 1024)
StringW from_utf8_1024(const String& ansi_string);

//! Conversion from ANSI to UTF-8 (dynamic buffer)
StringW from_utf8_ex(const String& ansi_string);

//////////////////////////////////////////////////////////////////////////

//! Conversion from UTF-16 to ANSI (static buffer MaxLen)
template<Int MaxLen>
String to_utf8(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (static buffer 1024)
String to_utf8_1024(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (dynamic buffer)
String to_utf8_ex(const CharW* wide_string);

//! Conversion from UTF-16 to ANSI (static buffer MaxLen)
template<Int MaxLen>
String to_utf8(const StringW& wide_string);

//! Conversion from UTF-16 to ANSI (static buffer 1024)
String to_utf8_1024(const StringW& wide_string);

//! Conversion from UTF-16 to ANSI (dynamic buffer)
String to_utf8_ex(const StringW& wide_string);

} //namespace utils
} //namespace tt
#include "utils/UnicodeConverter.inl"

#endif //_utils_UNICODECONVERTER_H_
